package com.act.web;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.act.domain.Employee;
import com.act.dto.Response;
import com.act.service.api.IEmployeeService;

@Controller
@RequestMapping("/employee")
public class EmployeeController {
	@Resource
	private IEmployeeService employeeService;

    @RequestMapping(value = "/add",method = RequestMethod.POST)
    @ResponseBody
    public Response add(Employee employee) {
    	 try {
    		 employeeService.add(employee);
             return Response.success();
         } catch (Exception e) {
           
             return Response.fail();
         }
	
    }

    @RequestMapping(value="/get",method=RequestMethod.GET)
    public @ResponseBody List<Employee> get(){
    	List<Employee> list=employeeService.getAll();
        return list;
    }
	
}
